1. Field of the Invention
This invention relates to a fuzzy computer capable of promptly calculating the center of gravity of a membership function.
2. Description of the Related Art
When a fuzzy operation is executed, in order to convert input x into information capable of being operated, it is necessary to calculate a function f(x) for the input x and then to calculate the center of gravity of the function as described in Tshio Terano et al, A Guide to the Fuzzy Computer System, Ohm Book Company, Inc., Apr. 30, 1987, pp. 150-152.
When a digital operation is executed, this function f(x) is defined as integer values f(0), f(1), f(2) . . . f(n-1), f(n) in discrete values x (x=0, 1, 2 . . . n-1, n). In general, when these functions f(x) are to be stored in a memory, these are stored from some address (FxBase in FIG. 1) sequentially in the order of f(0), f(1), f(2) . . . f(n-1), f(n) in the memory as shown in FIG. 1.
In FIG. 1, the left half portion shows the addresses and data of the memory, so does the right half portion configurations of the functions f(x).
As shown in FIG. 2 (a) through (e), in order to have the functions f(x) when the fuzzy operation is carried out, the portion of more than some value is cut (hereinafter referred to as the upper bound cut) from each of a plurality of basic functions (called membership functions) and then the maximum value of each input x is obtained to have the fuzzy function (hereinafter referred to as the maximum value operation).
In other words, the portions more than the respective values (the upper bound cut values) c1, c2, c3, c4 are cut from the functions g1(x), g2(x), g3(x), g4(x) shown in FIG. 2 (a) through (d), respectively, as a result, the portions in which the maximum value operation is provided are to be such a function f(x) shown in FIG. 2(e).
Now will be described in brief below the method of calculating the center of gravity of the function by the digital operation.
When calculating the center of gravity of each of the above functions for the values f(0), f(1), f(2) . . . f(n-1), f(n), these are defined with the value P/Q which is obtained by dividing such an equation P by such a equation Q as follows: EQU P=f(0).times.0+f(1).times.1+f(2).times.2+. . . +f(n-1).times.(n-1)+f(n).times.n EQU Q=f(0)+f(1)+f(2)+. . . f(n-1)+f(n).
Here, the equation P can be designated as follows: EQU P=(f(n))+(f(n)+f(n-1))+. . . +(f(n)+f(n-1)+. . . +f(2)+f(1)).
Then, in the case where the equation Q.sub.j is established as EQU Q.sub.j =f(n)+f(n-1)+f(n-2)+. . . +f(j+1)+f(j),
the equation P becomes as EQU P=Qn+Qn-1+Qn-2+. . . +Q2+Q1.
Furthermore, Q.sub.j designates the intermediate calculation results of Q, accordingly, P and Q can be obtained by the following operation steps.
(1) Assuming that j=n, Q.sub.j =0, P.sub.j =0,
(2) Q.sub.j is added to P.sub.j, and f(j) is added to Q.sub.j, respectively.
(3) 1 is subtracted from j.
(4) Operations in the steps (2), (3) are repeated until j becomes less than 0.
(5) The equations Q=Q.sub.j, P=P.sub.j are established.
Incidentally, there has existed no fuzzy computer of special purpose of executing such operations as described above, then, as means for executing the operations, there has been used nothing but a general purpose microprocessor. In the case where the operations are executed by MICROPROCESSOR 8088 manufactured by Intel Corp., for example, it has been necessary to make such a program as shown in FIG. 3. Meanwhile, the enlarged function f(x) of FIG. 2 is shown to be more in detail in FIG. 4.
FIG. 5 is a block diagram to illustrate the construction of the above-mentioned MICROPROCESSOR 8088 manufactured by Intel Corp.
In FIG. 5, the portion of MICROPROCESSOR 8088 is designated by both reference numerals 30 and 31, which designate an execution unit and a bus interface unit, respectively.
Reference numeral 32 designates the external memory which stores a program being as control data as well as works as means for storing data when the program is being carried out.
The execution unit 30 consists of an execution unit controller 33, a register file 34, an ALU 35, a flag register 36, and the internal bus 37, and the like.
The register file 34 consists of 8 sets of 16 bit-register which are called AX, BX, CX, DX, SI, DI, BP, and SP, respectively. Among these registers, each of the AX, BX, CX, and DX registers can be used to be divided into two sets of 8 bit-registers which are called AL and AH, BL and BH, CL and CH, and DL and DH, respectively.
The bus interface unit 31 controls data transfer between the external memory 32 and execution unit 30. In other words, the bus interface unit 31 performs the reading instructions and read/write of data in and from the external memory 32. Meanwhile, explanation on detailed construction of the bus interface unit 31 is not directly related to the description here, being omitted.
The execution unit 30 executes instructions.
The execution unit controller 33 decodes the instruction which was read, and controls execution of the instruction in the execution unit 30.
Both of the register file 34 and the flag register 36 store data in the execution unit 30.
The ALU 35 is an operation unit, and the internal bus 37 is a path for data transfer.
In the case where it is necessary to store such conditions as that carry is generated, operation results are negative, operation results are zero, and the like, these conditions are stored in their corresponding bits in the flag register 36. And the content of the flag register will be referred to as branch conditions of an branch instruction and the like.
Now will be described below the program of FIG. 3. The 3rd through 43rd lines of the figure designate the portion to be executed the upper bound cut and the maximum value operation. Incidentally, in those lines, it is assumed that the upper bound cut values c1, c2, c3, c4 in the processing of the upper bound cut have been loaded preliminarily in the four registers CL, CH, DL, DH as the initial state.
In FIG. 3, each of the 2nd, 11th, 22nd, 33rd and 44th lines designates comments (comments being designated after the mark ";" in some lines). And the 3rd through 10th lines designate processings of cutting the upper bound of the function g1(x) and storing this cut results as the initial value of the function f(x) in the memory as shown in FIG. 1 (here assuming that n=63).
Among the above lines, first, in the 3rd line, 63 is loaded in the SI register as the initial value of variable x.
And in the 4th line, a subroutine FUNC1 which calculates the function value g1(x) is called, and the function value g1(x) is stored in the AL register.
The subroutine FUNC1 calculates the function value with the variable x which is stored in the SI register as its input, and stores the function value of the calculation results as its output in the AL register, however, the content of this subroutine has no direct relation with the description here, being omitted. As in the same way as the content of this subroutine FUNC1, there is omitted explanation on the contents of the subroutines FUNC2, FUNC3 and FUNC4 which calculate such function values g2(x), g3(x) and g4(x), respectively which will be referred to later.
Then, in the 5th line, a comparison is made between the function value g1(x) being stored in the AL register and the upper bound cut value c1 being stored in the CL register, and when the upper bound cut value c1 is smaller than the function value g1(x), the upper bound cut value c1 is transferred to the AL register. In other words, the upper bound cut is carried out. On the other hand, when the upper bound cut value c1 is larger than the function value g1(x), the function value g1(x) is being stored in the AL register.
And in the 8th line, the content of the AL register (upper bound cut value c1 or function value g1(x)) is transferred to the memory as the initial value of the function f(x). In the 8th line, [BX]+[SI] designates a memory with an address having the value which is made by adding the content of the BX register to the content of the SI register, and because the FxBase is loaded in the BX register and the variable x is stored in the SI register in the 1st line, [BX]+[SI] is to designate the function f(x) of FIG. 1.
The above description is processings for one element.
After the processings in the 1st through 8th lines are completed, in the 9th line, 1 is subtracted from the SI register in which the variable x is being stored, and this subtraction is repeated until the variable x of the subtraction results becomes negative.
The 10th line designates an instruction to jump to RptFc1 when operation results just before the subtraction results are not negative. Accordingly, the above subtraction is repeated 64 times until the variable x becomes from 63 to 0, as a result, the function g1(x) whose upper bound was cut is to be stored in the address FxBase through FxBase+63 of the memory.
Now will be described below processings in the 12th through 21st lines. These lines shows both the upper bound cut and the maximum value operation of the function g2(x).
In the 16th line in the figure, the processings until the upper bound cut is carried out are the same as those for the above-mentioned function g1(x). In this case, however, there are employed the subroutine FUNC2 as a subroutine which generates the function and the CH register as the upper bound cut value in the processing of the upper bound cut, respectively.
Then, in the 17th line, there is made a comparison between the function value g2(x) being stored in the AL register after its upper bound is cut and the function value f(x) being stored in the memory. And where the function value g2(x) is larger than the function value f(x), in the 18th line, the function value g2(x) is transferred to a position where the function value f(x) is being stored in the memory. On the other hand, where the function value g2(x) is smaller than the function value f(x), the function value f(x) is to be left as it is. In other words, the maximum value operation is to be carried out.
In the 20th and 21st lines, as in the same way as in the case of the function g1(x), subtraction of the variable x and control of repeat processing are carried out, and the above processing is repeated until the variable x becomes from 63 to 0.
As a result, the function values g1(x) and g2(x) whose upper bounds were cut and for which the maximum value operation were provided are to be stored in the addresses FxBase through FxBase+63 of the memory.
The same upper bound cut and maximum value operation as mentioned above are carried out for the function g3(x) in the 23rd through 32nd lines, so are for the function g4(x) in the 34th through 43rd lines.
As a result, in the 45th line, results of the upper bound cut and maximum value operation for each of the functions g1(x), g2(x), g3(x) and g4(x) are to be stored in the addresses FxBase through FxBase+63 of the memory, respectively.
In the 45th through 52nd lines, calculation of the center of gravity is carried out according to procedures of the above-mentioned processings.
In the 45th through 47th lines, j, Q.sub.j and P.sub.j are initialized, and the values 63, 0, and 0 are loaded in the SI register, the AX register, and the DI register, respectively.
In the 48th and 50th lines, Q.sub.j is added to P.sub.j, and f(j) is added to Q.sub.j, respectively, and in the 48th line, the content of the AX register is added to the content of the DI register.
In the 49th line, since f(j) of 8 bits is being stored, f(j) is added to the content of the AL register (8 low order bits of AX register), first. And in the 50th line, carry is added to the AH register (8 high order bits of AX register).
As a result, f(x) of 8 bits is added to the content of the Ax register of 16 bits.
In the 51st and 52nd lines, the subtraction of j and the control of repeating the subtraction are carried out, and control is carried out so that the above processing can be repeated until j becomes from 63 to 0.
A summary of the processings of the program of FIG. 3 is as mentioned above. After this program is carried out, Q is obtained in the AX register and P is obtained in the DI register, respectively, accordingly, the value of the center of gravity can be obtained by dividing Q by P.
Incidentally, among those membership functions, there are not more than two or three functions which overlaps with each other, that is, which have the values excepting 0 as their respective variables x, and it is rare occasion that more than four functions have the values excepting 0 as the same variable x.
For example, in FIG. 4, in the case where the variable x is 28, the functions g2(x), g3(x) alone have the values excepting 0, and other functions g1(x), g4(x) have the value 0. In other words, in the program of FIG. 3, there are made comparisons for all of the functions g2(x), g3(x), g4(x) for the upper bound cut and the maximum value operation, as a result, three times of comparison are made for the respective variables x.
However, there are two functions which overlaps with each other, then, in reality, it is necessary to make only one comparison for the respective variables x of the two functions, and it is not necessary to make other two times of comparison here. For example, in the case where the variable x is 28, the upper bound cut is carried out for the functions g2(x), g3(x) alone, and then there is made a comparison between both of the functions after the upper bound cut was provided to select the larger one, as a result, it is not necessary to take the functions g1(x) and g4(x) into consideration.
In the above conventional fuzzy computer, the upper bound cut and the calculation of the center of gravity have been carried out according to the above procedures, and these conventional operations entail a lot of useless comparison processings, as a result, there exists a problem that it takes long time to calculate the center of gravity of the function.